﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Ecreate.Web.usercontrol
{
    public partial class ucClassList : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string sql = "select * from t_product_class";
            DataTable dt = GG.GetTable(sql);
            string html = "";
            foreach (DataRow dr1 in dt.Select("parentclassid='-1'"))
            {
                string li2 = "";
                int i = 1;
                foreach (DataRow dr2 in dt.Select("parentclassid='" + dr1["classid"].ToString() + "'"))
                {
                    if (i == 4)
                    {
                        li2 += "<br />";
                        i = 1;
                    }
                    if (i == 1)
                    {
                        li2 += "<li class=\"blue\">";
                    }
                    li2 += "<a href=\"../pages/ProductList.aspx?type=c2&id=" + dr2["classid"].ToString() + "\" target=\"_blank\">" + dr2["classname"].ToString() + "</a> ";
                    if (i == 3)
                    {
                        li2 += "</li>";
                    }
                    i++;
                }
                string img = "<img alt=\"\" src=\"../pages/images/arrow.gif\" />";
                string li1 = "<li class=\"f14 fb\">" + img + dr1["classname"].ToString() + "</li>";
                string ul1 = "<ul>" + li1 + li2 + "</ul>";
                html += ul1;
            }
            Literal1.Text = html;
        }
    }
}